<template>
  <el-row :gutter="20">
    <ms-card title="用户表" :col=14 save-button="添加" @saveClick="$refs['roleTable'].handleOpenDialog()">
      <role-table @clickRow="handleClickRow" ref="roleTable" />
    </ms-card>
    <ms-card title="关联权限" save-button="保存权限" :col=10 :ifbutton="ifbutton" @saveClick="$refs['roleMenu'].getRoleTreeKeys()">
      <role-menu :role-id="roleId" ref="roleMenu" />
    </ms-card>
  </el-row>
</template>

<script>
import MsCard from '@/common/card/components'
import RoleMenu from './Menu'
import RoleTable from './RoleTable'
export default {
  components: {
    MsCard,
    RoleMenu,
    RoleTable
  },
  data() {
    return {
      roleId: '',
      ifbutton: false
    }
  },
  methods: {
    handleClickRow(val, perimission) {
      this.roleId = val
      // 当选择人为超级管理员时 不可进行数据保存
      this.ifbutton = perimission !== 'admin'
    }
  }
}
</script>
